package com.health.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.health.R;
import com.health.tablebean.BD_DD_DRUG;

import java.util.List;

/**
 * author : xiaoxin
 * date   : 2020/7/25 14:29
 * desc   :
 * update :
 */
public class DrugManagerAdapter extends BaseQuickAdapter<BD_DD_DRUG, BaseViewHolder> {

    public DrugManagerAdapter(int layoutResId, @Nullable List<BD_DD_DRUG> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BD_DD_DRUG item) {

        helper.setText(R.id.drug_id,"序号:"+item.getId())
                .setText(R.id.drug_name,"名称:("+item.getProname()+")"+item.getDrugs() +
                        "(" + item.getAbbreviation() + ")" + "  " + item.getUsage()
                                + "    " + item.getDosage())
//                .setText(R.id.drug_usage,"用法:"+item.getUsage())
//                .setText(R.id.drug_dosage,"用量:"+item.getDosage())
                .setText(R.id.drug_res1,"每次"+item.getRes1() + item.getRes2() + " 每日"
                        + item.getRes3() + "次");
        if(null!=item.getTjdrugname()){
//            helper.setText(R.id.tj_drug_name,"调整用药:("+item.getTjproname()+")"+item.getTjdrugname()) ;
            helper.setText(R.id.tj_drug_name,"调整用药:"+item.getTjdrugname()) ;
        }else {
            helper.setText(R.id.tj_drug_name,"调整用药:暂无" ) ;
        }

        switch (item.getType()) {
            case "gxy":
                helper.setText(R.id.drug_type,"高血压");
                break;
            case "tnb":
                helper.setText(R.id.drug_type,"糖尿病");
                break;
            case "jsb":
                helper.setText(R.id.drug_type,"精神病");
                break;
        }
    }
}
